E:/E+I/Informatik/Projekte/FH/n-Damen Problem/attack.c

Go to the documentation of this file.
00001 
00009 #include "ndame.h"
00010 
00025 int attack(struct data*d1,int ii,int ik)
00026 {
00027     int irow;
00028     int icol;
00029     
00030     irow=ii;                                          //reset board position
00031     icol=ik;                                          //reset board position
00032     
00033     for(irow;irow>=0;irow--)                          //lower
00034     {
00035         if(d1->iboard[irow][icol])
00036         {
00037             return 1;
00038         }
00039     }
00040     irow=ii;                                          //reset board position                                       
00041     
00042     while((irow>=0)&&(icol>=0))                       //left lower;
00043     {
00044         if(d1->iboard[irow][icol])
00045         {
00046             return 1;
00047         }
00048         
00049         irow--;
00050         icol--;
00051     }
00052     irow=ii;                                          //reset board position
00053     icol=ik;                                          //reset board position
00054     
00055     while((irow>=0)&&(icol<d1->iblength))             //right lower;
00056     {
00057         if(d1->iboard[irow][icol])
00058         {
00059             return 1;
00060         }
00061         
00062         irow--;
00063         icol++;
00064     }
00065     
00066     return 0;
00067 }

Generated on Sun Dec 18 19:26:13 2005 for n-Queens Problem by  doxygen 1.4.5